# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>

pkgname=breezy
_verbase=3.1.0
_verminor=8
pkgver=${_verbase}.${_verminor}
pkgrel=1
pkgdesc='A decentralized revision control system with support for Bazaar and Git file formats'
arch=('i686' 'x86_64')
url='https://www.breezy-vcs.org/'
license=('GPL2')
groups=('VCS')
depends=('python-configobj'
         'python-fastimport'
         'python-dulwich'
         'python-patiencediff'
         'python-six')
makedepends=('python-setuptools' 'python-devel')
provides=(bzr)
conflicts=(bzr)
replaces=(bzr)
source=(${pkgname}-${pkgver}.tar.gz::https://github.com/breezy-team/breezy/archive/${_verbase}-${_verminor}.tar.gz
        '0002-add-msys2-certs-location.patch')
sha256sums=('a2781e9af980ceb62087a78894c2706b17f2ea044253dff7d03fc14f1e4f75d9'
            '8f3a1c151c9ceb8b2ace12dc1c80bd123810e2e77a2c784385d5ad039f0bd3bb')

prepare(){
  cd "${srcdir}/${pkgname}-${_verbase}-${_verminor}"

  patch -p1 -i ${srcdir}/0002-add-msys2-certs-location.patch
}

build() {
  cd "${srcdir}/${pkgname}-${_verbase}-${_verminor}"

  python setup.py build --parallel "$(nproc)"
}

package() {
  cd "${srcdir}/${pkgname}-${_verbase}-${_verminor}"

  python setup.py install --root="${pkgdir}" --install-data=usr/share --optimize=1 --skip-build
  cp "${pkgdir}"/usr/bin/brz "${pkgdir}"/usr/bin/bzr
}
